<?php

class Application_Form_Inscription extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	
    	$this->setMethod('post');
    	
    	$CIN = new Zend_Form_Element_Text('CIN');
    	$CIN->setLabel('CIN')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
		->setRequired(true)
    	->setAttrib("class", "validate[required]");
    	
    	
    	$nom = new Zend_Form_Element_Text('nom');
    	$nom->setLabel('Last name')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required]");
    	
    	$prenom = new Zend_Form_Element_Text('prenom');
    	$prenom->setLabel('First name')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required]");
    	
    	$email = new Zend_Form_Element_Text('email');
    	$email->setLabel('E-mail')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required,custom[email]]");
    	
    /*	$login = new Zend_Form_Element_Text('login');
    	$login->setLabel('nom d\'utilisateur')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required]");*/
    	
    	
    	$password = new Zend_Form_Element_Password('password');
    	$password->setLabel('Password')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required]");
    	
    	
    	$telephone = new Zend_Form_Element_Text('telephone');
    	$telephone->setLabel('telephone')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty')
    	->setAttrib("class", "validate[required]");
    	
    	/*$adresse = new Zend_Form_Element_Textarea('adresse');
    	$adresse->setLabel('adresse:')
    	->setRequired(true)
    	->setAttrib('COLS', '40')
    	->setAttrib('ROWS', '4');*/
    	
    	$tab=new Application_Model_Mapper_Etabuniv();
    	$select=$tab->fetchAllToArray();
    	
    	$tmp=array();
    	
    	
    	$university= new Zend_Form_Element_select('ETATB');
    	
    	$university->addMultiOption( "","");
    	$university->setLabel('University ')
		->setRequired(true);
    	foreach ($select as $key => $value ){
    		
    			$university->addMultiOption($value['CETAB'],utf8_encode($value['LIBETAB']));
    		
    		
    	}
    	
    	
    	
    	
    	
    	$submit = new Zend_Form_Element_Submit('submit',"Enregistrer");
    	 
    	$this->addElements(array($CIN,$nom,$prenom,$email,$telephone,$university,$password,$submit));
    	$this->setDecorators( array( array('ViewScript', array('viewScript' => 'inscriprotypeform.phtml'))));
    	
    }


}

